<?php

/**
 * Copyright              [HD框架] (C)2011-2012 houdunwang ，Inc. 
 * Encoding               UTF-8 
 * Version                $Id: fields      2012-8-28 22:11:01
 * @author                向军
 * Link                   http://www.houdunwang.com       
 * E-mail                 houdunwangxj@gmail.com
 */
class tag {

    function _field($attr, $content) {
        $mid = isset($attr['mid']) ? $attr['mid'] : isset($_GET['mid']) ? $_GET['mid'] : FALSE;
        if ($mid === FALSE) {
            error("fields缺少mid参数");
        }
        $str = '';
        $str.='<?php $fieldArr = field::get_all(' . $mid . ');'; //获得所有字段
        $str.='foreach ($fieldArr as $v) :';
        $str.='$v["fieldset"]["value"] = isset($field[$v["fname"]]) ? 
            $field[$v["fname"]] : $v["fieldset"]["value"];';
        $str.='$field["title"] = $v["title"];';
        $str.='$field["description"]=$v["description"];';
        $str.='$field["html"] = field::field_html($v);?>';
        $str.=$content;
        $str.='<?php endforeach;?>';
        return $str;
    }

}

?>
